import 'package:flutter/material.dart';

main() {
  runApp(HomePage());
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: A(),
    );
  }
}

class A extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _A();
  }
}

class _A extends State<A> {
  ScrollController controller = ScrollController();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Row(
          children: [
            Expanded(
              child: ListView.builder(
                controller: controller,
                itemBuilder: (c, i) {
                  return ListTile(
                    title: Text('$i'),
                  );
                },
                itemCount: 100,
              ),
            ),
            Expanded(
                child: Column(
              children: [
                ElevatedButton(
                    onPressed: () {
                      var pixels2 = controller.position.pixels;
                      print(pixels2);
                    },
                    child: Text('data1')),
                ElevatedButton(
                    onPressed: () {
                      controller.animateTo(300,
                          duration: const Duration(seconds: 2),
                          curve: Curves.linear);
                    },
                    child: Text('data2'))
              ],
            ))
          ],
        ),
      ),
    );
  }
}
